{% extends "main/base.html" %}
{% load static i18n %}
{% block title %}{% trans '创建订单' %}{% endblock %}
{% block this_css %}
<link rel="stylesheet" type="text/css" href="{% static 'flatlab/css/bootstrap-select.min.css' %}">
{% endblock %}
{% block content %}
<div class="panel">
    <header class="panel-heading">
        {% trans "创建订单" %}
        {% if form.errors %}
        <p>{% trans "提交的数据有误,请认真检查!" %}</p>
        {% endif %}
    </header>
    <div class="panel-body">
        <form method="post" class="form-horizontal">{% csrf_token %}
            {{ form.non_field_errors }}
            <input type="hidden" name="created_by" id="id_created_by" value="{{ request.user.id }}">
            <div class="form-group" align="right">
                <div class="col-md-12">
                    <a href="{% url 'main:order_list' %}"><button type="button" class="btn btn btn-primary">{% trans "返回" %}</button></a>
                    <button type="submit" class="btn btn-danger">{% trans "创建" %}</button>
                </div>
            </div>
            <div class="form-group col-md-6">
                <div class="col-sm-3">{{ form.order_code.label_tag }}</div>
                <div class="col-sm-9">{{ form.order_code }}{{ form.order_code.errors }}</div>
            </div>
            <input type="hidden" name="order_state" id="id_order_state" value="1">
            <div class="form-group col-md-6">
                <div class="col-sm-3">{{ form.order_desc.label_tag }}</div>
                <div class="col-sm-9">{{ form.order_desc }}{{ form.order_desc.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-6">
                <div class="col-sm-3">{{ form.client.label_tag }}</div>
                <div class="col-sm-9">{{ form.client }}{{ form.client.errors }}</div>
            </div>
            <div class="form-group col-md-6">
                <div class="col-sm-3">{{ form.salesman.label_tag }}</div>
                <div class="col-sm-9">{{ form.salesman }}{{ form.salesman.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-6">
                <div class="col-sm-3">{{ form.sub_company.label_tag }}</div>
                <div class="col-sm-9">{{ form.sub_company }}{{ form.sub_company.errors }}</div>
            </div>
            <div class="form-group col-md-6">
                <div class="col-sm-3">{{ form.order_create_date.label_tag }}</div>
                <div class="col-sm-4">{{ form.order_create_date }}{{ form.order_create_date.errors }}</div>
                <div class="col-sm-3">{{ form.order_validity_date_delta.label_tag }}</div>
                <div class="col-sm-2">{{ form.order_validity_date_delta }}{{ form.order_validity_date_delta.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-6">
                <div class="col-sm-3">{{ form.manufacturing_days.label_tag }}</div>
                <div class="col-sm-3">{{ form.manufacturing_days }}{{ form.manufacturing_days.errors }}</div>
                <div class="col-sm-3">{{ form.success_rate.label_tag }}</div>
                <div class="col-sm-3">{{ form.success_rate }}{{ form.success_rate.errors }}</div>
            </div>
            <div class="form-group col-md-6">
                <div class="col-sm-3">{{ form.export_price.label_tag }}</div>
                <div class="col-sm-4">{{ form.export_price }}{{ form.export_price.errors }}</div>
                <div class="col-sm-3">{{ form.tax_rate.label_tag }}</div>
                <div class="col-sm-2">{{ form.tax_rate }}{{ form.tax_rate.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-9">
                <div class="col-sm-2">{{ form.order_pay_method.label_tag }}</div>
                <div class="col-sm-10">{{ form.order_pay_method }}{{ form.order_pay_method.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-9">
                <div class="col-sm-2">{{ form.order_notes.label_tag }}</div>
                <div class="col-sm-10">{{ form.order_notes }}{{ form.order_notes.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-9">
                <div class="col-sm-2">{{ form.transport_type.label_tag }}</div>
                <div class="col-sm-10">{{ form.transport_type }}{{ form.transport_type.errors }}</div>
            </div>
            <div class="form-group col-md-3">
                <div class="col-sm-6">{{ form.transport_cost.label_tag }}</div>
                <div class="col-sm-6">{{ form.transport_cost }}{{ form.order_create_date.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-9">
                <div class="col-sm-2">{{ form.installation_desc.label_tag }}</div>
                <div class="col-sm-10">{{ form.installation_desc }}{{ form.installation_desc.errors }}</div>
            </div>
            <div class="form-group col-md-3">
                <div class="col-sm-6">{{ form.install_cost.label_tag }}</div>
                <div class="col-sm-6">{{ form.install_cost }}{{ form.install_cost.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-9">
                <div class="col-sm-2">{{ form.Installation_materials.label_tag }}</div>
                <div class="col-sm-10">{{ form.Installation_materials }}{{ form.Installation_materials.errors }}</div>
            </div>
            <div class="form-group col-md-3">
                <div class="col-sm-6">{{ form.material_cost.label_tag }}</div>
                <div class="col-sm-6">{{ form.material_cost }}{{ form.material_cost.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-9">
                <div class="col-sm-2">{{ form.bank_account.label_tag }}</div>
                <div class="col-sm-10">{{ form.bank_account }}{{ form.bank_account.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-9">
                <div class="col-sm-2">{{ form.app_notes.label_tag }}</div>
                <div class="col-sm-10">{{ form.app_notes }}{{ form.app_notes.errors }}</div>
            </div>
            <div class="form-group col-md-3">
                <div class="col-sm-6">{{ form.show_app_notes.label_tag }}</div>
                <div class="col-sm-6">
                    <div class="switch switch-square"
                        data-on-label="<i class=' fa fa-check'></i>"
                        data-off-label="<i class='fa fa-times'></i>">
                        {{ form.show_app_notes }}
                    </div>
                {{ form.show_app_notes.errors }}</div>
            </div>
            <div class="clearfix"></div>
            <div class="form-group col-md-12" align="right">
                <a href="{% url 'main:order_list' %}"><button type="button" class="btn btn btn-primary">{% trans "返回" %}</button></a>
                <button type="submit" class="btn btn-danger">{% trans "创建" %}</button>
            </div>
        </form>
    </div>
</div>
{% endblock %}
{% block this_js %}
<script type="text/javascript" src="{% static 'flatlab/js/bootstrap-switch.js' %}"></script>
<script type="text/javascript" src="{% static 'flatlab/js/bootstrap-select.min.js' %}"></script>
{% endblock %}